Write the build script output ASAP
authorAlex Crichton <alex@alexcrichton.com>
Wed, 7 Oct 2015 16:23:32 +0000 (09:23 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 7 Oct 2015 16:23:32 +0000 (09:23 -0700)
This can help debug some situations if an error happens parsing the output.

src/cargo/ops/cargo_rustc/custom_build.rs

index 1232fa9c21ae1a85a38581ef049d42cb7ceee768..26d8f6341b69afe527811f195c8bb5c4d8440b40 100644 (file)
@@ -160,6 +160,8 @@ pub fn prepare(cx: &mut Context, unit: &Unit)
                              pkg_name, e.desc);
             Human(e)
         }));
+        try!(paths::write(&build_output.parent().unwrap().join("output"),
+                          &output.stdout));
 
         // After the build command has finished running, we need to be sure to
         // remember all of its output so we can later discover precisely what it
@@ -173,9 +175,6 @@ pub fn prepare(cx: &mut Context, unit: &Unit)
         }));
         let parsed_output = try!(BuildOutput::parse(output, &pkg_name));
         build_state.insert(id, kind, parsed_output);
-
-        try!(paths::write(&build_output.parent().unwrap().join("output"),
-                          output.as_bytes()));
         Ok(())
     });